package com.api.shopapi.service.impl;

import com.api.shopapi.entity.SBJHeartRateData;
import com.api.shopapi.mapper.SBJHeartRateDataMapper;
import com.api.shopapi.service.SBJHeartRateDataService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("SBJHeartRateDataServiceImplOne")
public class SBJHeartRateDataServiceImpl implements SBJHeartRateDataService {

    @Autowired
    private SBJHeartRateDataMapper sbjHeartRateDataMapper;

    @Override
    public int insert(SBJHeartRateData sbjHeartRateData) {
        return sbjHeartRateDataMapper.insert(sbjHeartRateData);
    }

    @Override
    public PageInfo<SBJHeartRateData> getHeartRateDataPageByDeviceId(int pageIndex, int pageSize, String deviceId, String startTime, String endTime) {
        PageHelper.startPage(pageIndex,pageSize);
        List<SBJHeartRateData> sbjHeartRateDataList = sbjHeartRateDataMapper.getHeartRateDataPageByDeviceId(deviceId, startTime, endTime);
        return new PageInfo<>(sbjHeartRateDataList);
    }
}
